
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>纯CSS3属性animation实现的打字效果</title>
	<style>
	*{margin:0;padding:0;}
	@keyframes typing { from { width: 0; } }
	@keyframes blink-caret { 50% { border-color: transparent; } }
	text {
		font: bold 200% Consolas, Monaco, monospace;
		border-right: .1em solid;

		width: 16.5em; /* fallback */
		width: 15ch; /* # of chars */

		margin: 2em 1em;
		white-space: nowrap;
		overflow: hidden;
		animation: typing 20s steps(30, end), /* # of steps = # of chars */
					blink-caret .5s step-end infinite alternate;
	}
	</style>
</head>
<body>
	<text style="width: 200px;font-size: 1rem;"></text>
</body>
</html>